<template>
  <div id="app">
    <router-view>
      <!-- <IndexView /> -->
    </router-view>
  </div>
</template>

<script>
// import IndexView from "@/views/IndexView.vue";
export default {
  name: "App",
  components: {},

  //===========================下面是解决刷新页面丢失vuex数据
  created() {
    //在页面加载时读取sessionStorage里的状态信息 , 防止刷新的时候数据丢失 将备份将state赋值
    if (localStorage.getItem("store")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(localStorage.getItem("store"))
        )
      );
    }
    //在页面刷新时将保存在local本地缓存里的信息保存到sessionStorage里  备份;
    window.addEventListener("beforeunload", () => {
      localStorage.setItem("store", JSON.stringify(this.$store.state));
    });
  },
  destroyed() {},
  mounted() {
    // 关闭浏览器窗口的时候清空浏览器缓存在localStorage的数据
    // if (sessionStorage.getItem("auth")) {
    //   window.onbeforeunload = function (e) {
    //     var storage = window.localStorage;
    //     storage.clear();
    //   };
    // }
  },
};
</script>

<style>
#app {
}

html,
body {
  position: relative;
  cursor: url("https://map-zblog.oss-cn-guangzhou.aliyuncs.com/backgroundImg/default.cur"),
    auto;
  background: url("https://www.toptal.com/designers/subtlepatterns/uploads/email-pattern.png");
}
#nprogress .bar {
  padding: 0 !important;
  color: rgb(15, 75, 96) !important;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0;
}

::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 8px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  cursor: pointer;
  border-radius: 5px;
  /*background: #fd7286;*/
  transition: color 0.2s ease;
  background-image: linear-gradient(aquamarine, #fd7286, lightgreen);
}
</style>
